package ru.mipt.simt;

import java.util.Random;

public class Source
{
	protected static int id = 0;
	protected Random r;

	protected double v0;
	protected double a0;
	protected double t0;
	protected double width;
	protected double length;

	protected double dV0;
	protected double dA0;
	protected double dT0;
	protected double dWidth;
	protected double dLength;

	protected double t = 0;

	public Source(double v0, double a0, double t0, double width, double length, double dV0, double dA0, double dT0,
			double dWidth, double dLength)
	{
		super();
		this.v0 = v0;
		this.a0 = a0;
		this.t0 = t0;
		this.width = width;
		this.length = length;
		this.dV0 = dV0;
		this.dA0 = dA0;
		this.dT0 = dT0;
		this.dWidth = dWidth;
		this.dLength = dLength;
		r = new Random();
	}

	public Source(double v0, double a0, double t0, double width, double length)
	{
		this(v0, a0, t0, width, length, 0, 0, 0, 0, 0);
	}

	public Car getCar(double t)
	{
		if (t - this.t > 10)
		{
			this.t = t;
			return new Car(this, id++, width, length, v0, a0, t0);
		}
		return null;
	}

}
